var pageii = null;
var grid = null;
$(function() {

	grid = lyGrid({
		pagId : 'paging',
		l_column : [ {
			colkey : "date",
			name : "日期",
			renderData : function(rowindex,data, rowdata, column) {
				if(data!=''){
					return new Date(data).format("yyyy-MM-dd");
				}else{
					return "";
				}
			}
		},{
			colkey : "date",
			name : "时间",
			renderData : function(rowindex,data, rowdata, column) {
				if(data!=''){
					return new Date(data).format("hh:mm:ss");
				}else{
					return "";
				}
			}
		}, {
			colkey : "schedule",
			name : "班别",
			renderData : function(rowindex,data, rowdata, column) {
				if (data==1 || data=="1"){
					return "甲班";
				}else if (data==2 || data=="2"){
					return "乙班";
				}else{
					return "";
				}
			}
		}, {
			colkey : "userName",
			name : "发出指令的调机员"
		}, {
			colkey : "machine_no",
			name : "机台号"
		}, {
			colkey : "mold_encode",
			name : "模具号"
		}],
		jsonUrl : rootPath + '/loadOrder/loadOrder_findByPage.shtml',
		dymCol:true,
		checkbox : true,
		serNumber : false
	});
	$("#editFun").click("click", function() {
		editAccount();
	});
	$("#search").click("click", function() {// 绑定查询按扭
		
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});
	
});
function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1 || cbox == "") {
		layer.msg("只能选中一个");
		return;
	}
	pageii = layer.open({
		title : "编辑装模指令表",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath + '/loadOrder/loadOrder_edit.shtml?id=' + cbox
	});
}
